<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload = function() {
            {
                let person = {
                    age: 12,
                    name: 'zhangsan',
                    gender: 'male'
                }

                let {
                    age,
                    name,
                    gender
                } = person;
                console.log(age, name, gender);
            } {
                let arr = ['a', 'b', 'c'];
                let [first, , third] = arr;
                console.log(first); // a
                console.log(third); // c
                let color = ['red', ['green', 'yello'], 'blue'];
                // let [firstColor, [secondColor]] = color;
                let [firstColor, ...restColors] = color;
                console.log(restColors);
                console.log(firstColor); // red
                // console.log(secondColor); // green
            } {
                let color = ['red', ['green', 'yello'], 'blue'];
                var clonedColor = color.concat(); // ES5克隆数组
                console.log(clonedColor); // ["red", Array(2), "blue"]
                let cloned = [...color]; // ES6克隆数组
                console.log(cloned)
            }
        }
    </script>
</head>

<body>

</body>

</html>